import { Create, Update, Delete, Get, GetAll, GetTreeList } from '@/services/crud';
const DepartModel = {
    namespace: 'Department',
    state: {
        response: {},
        deptlist: [],
    },
    effects: {
        * getAll({ payload }, { call, put }) {
            const response = yield call(GetAll, payload, 'Department');
            yield put({
                type: 'savedept',
                payload: response,
            });
        },
    },
    reducers: {
        deal(state, action) {
            return { ...state, response: action.payload };
        },
        savedept(state, action) {
            var lists = [];
            if (action.payload.result) {
                lists = action.payload.result.items;
            }
            return { ...state, deptlist: lists };
        },
    },
};
export default DepartModel;